package com.ruoyi.system.controllerApi;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.WeatherForecast;
import com.ruoyi.system.service.IWeatherForecastService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/weatherForecast")
public class WeatherForecastApiController {

    @Autowired
    private IWeatherForecastService weatherForecastService;

    /**
     * 查询七日天气预报
     * @param
     * @return
     */
    @GetMapping("/SevenDay")
    public AjaxResult getWeatherForecast() {
        List<WeatherForecast> list = weatherForecastService.getWeatherForecastSeven();
        return AjaxResult.success(list);
    }
    @GetMapping("/getWeatherForecast")
    public AjaxResult getWeatherForecast(String date) {
        List<WeatherForecast> weatherForecast = weatherForecastService.selectWeatherForecastList(null);
        return AjaxResult.success(weatherForecast);
    }

}
